import request from './request';

// 获取主机出租订单列表（只获取产品分类为主机出租的订单）
export function getServerRentalList(params) {
  return request({
    url: '/api/omm/orders/server-rental/',
    method: 'get',
    params
  });
}

// 获取单个主机出租订单
export function getServerRental(id) {
  return request({
    url: `/api/omm/orders/${id}/`,
    method: 'get'
  });
}

// 新增主机出租订单
export function createServerRental(data) {
  return request({
    url: '/api/omm/orders/',
    method: 'post',
    data
  });
}

// 更新主机出租订单
export function updateServerRental(id, data) {
  return request({
    url: `/api/omm/orders/${id}/`,
    method: 'put',
    data
  });
}

// 删除主机出租订单
export function deleteServerRental(id) {
  return request({
    url: `/api/omm/orders/${id}/`,
    method: 'delete'
  });
}

// 批量删除主机出租订单
export function batchDeleteServerRentals(ids) {
  return request({
    url: '/api/omm/orders/batch_delete/',
    method: 'post',
    data: { ids }
  });
}

// 导出主机出租订单数据
export function exportServerRentals(params) {
  return request({
    url: '/api/omm/orders/server-rental/export/',
    method: 'get',
    params,
    responseType: 'blob',
    timeout: 60000 // 60秒超时
  });
}

// 获取主机出租产品列表
export function getServerRentalProducts() {
  return request({
    url: '/api/omm/products/server-rental/',
    method: 'get'
  });
} 